const xml2js=require("xml2js");
var obj={
    ToUserName:'gh_61663fb98a01',
    FromUserName:'ohtV-t1TYEm9p9EvmtGpOWonRBuU',
    CreateTime:1559444354,
    MsgType:'text',
    Content:'你好'
}
const build=new xml2js.Builder({rootName:'root',headless:true,cdata:true});
// 同步转换
var xmlstr=build.buildObject(obj);
console.log(xmlstr);